<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head lang="en">
    <meta charset="utf-8"/>
    <title>网上订餐</title>
    <link th:href="@{/project/css/public.css}" rel="stylesheet"/>
    <link th:href="@{/project/css/myorder.css}" rel="stylesheet"/>
    <link th:href="@{/project/css/proList.css}" rel="stylesheet"/>
</head>
<body>
<!------------------------------head------------------------------>
<div class="head ding" th:include="include::normal_headDiv2"></div>
<!------------------------------idea------------------------------>
<div class="address mt">
    <div class="wrapper clearfix">
        <a th:href="@{/index}" class="fl">首页</a>
        <span>/</span>
        <a class="on">我的收藏</a>
    </div>
</div>

<!------------------------------Bott------------------------------>
<div class="Bott">
    <div class="wrapper clearfix">
        <div class="zuo fl" th:include="include::normal_left_menu"></div>
        <div class="you fl">
            <div class="my clearfix">
                <h2 class="fl">我的收藏</h2>
            </div>
            <ul class="proList prefer" id="dataContainer"></ul>
        </div>
    </div>
</div>
<!----------------mask------------------->
<div id="footer" th:include="include::normal_footerDiv"></div>
<div th:include="include::footer_normal"></div>
<script th:src="@{/project/cart.js}"></script>
<script th:inline="javascript">
    $(function () {
        queryPrefer();
    });
    var _$dataItem = $('<li>' +
        '<a class="a1" href="">' +
        '<dl>' +
        '<dt><img></dt>' +
        '<dd></dd>' +
        '<dd>' +
            '<span class="fl"></span>' +
            '<a href="javascript:void(0)" title="取消收藏" class="prefer cancel fr"><span></span></a>' +
        '</dd>' +
        // '<dd></dd>' +
        '</dl>' +
        '</a>' +
        '</li>');
    //分页查询收藏列表
    function queryPrefer(){
        $("#dataContainer").paginationInit({
            url:ctx+"user/userGoodsPrefer/list",
            loadDataItem:function (obj) {
                obj = obj.info;
                _$dataItem.find(".a1").attr("href", goodsClickHref(obj.goodsId));
                _$dataItem.find("img").attr("src", obj.imgUrl);
                _$dataItem.find("dd:eq(0)").html(obj.goodsName);
                _$dataItem.find("dd:eq(1) span:eq(0)").html("￥" + obj.goodsPrice);
                _$dataItem.find(".prefer").attr("onclick","preferCancel2("+obj.goodsId+")");
                return _$dataItem[0].outerHTML;
            }
        });
    }
    //取消收藏
    function preferCancel2(goodsId) {
        preferCancel(null,goodsId,function () {
            queryPrefer();
        });
    }
</script>
</body>
</html>
